import request from '@/utils/request'

export function fetchList(listQuery) {
  return request({
    url: '/getDocumentInfo',
    method: 'post',
    data: {
      documentName: listQuery.documentName,
      type: listQuery.type,
      author: listQuery.author,
      status: listQuery.status
    },
    params: {
      pageNum: listQuery.page,
      pageSize: listQuery.limit
    }
  })
}

export function fetchReduceList(listQuery) {
  return request({
    url: '/getReduceDocumentInfo',
    method: 'post',
    data: {
      documentName: listQuery.documentName,
      type: listQuery.type,
      author: listQuery.author,
      status: listQuery.status
    },
    params: {
      pageNum: listQuery.page,
      pageSize: listQuery.limit
    }
  })
}

export function fetchArticle(id) {
  return request({
    url: '/getDocumentInfoById',
    method: 'get',
    params: { id }
  })
}

export function fetchPv(id) {
  return request({
    url: '/getDataInfoById',
    method: 'get',
    params: { id }
  })
}



export function createArticle(data) {
  return request({
    url: '/insertData',
    method: 'post',
    data
  })
}

export function deletArticle(id) {
  return request({
    url: '/deletDataByID/' + id,
    method: 'delete'
  })
}

export function updateArticle(data) {
  return request({
    url: '/updateDataInfo',
    method: 'post',
    data
  })
}

export function fakeDelete(id) {
  return request({
    url: '/deletDocumentByID/' + id,
    method: 'delete'
  })
}

export function deepDeletDocument(id) {
  return request({
    url: '/deepDeletDocumentByID/' + id,
    method: 'delete'
  })
}

export function reduceDocument(id) {
  return request({
    url: '/reduceDocumentByID/' + id,
    method: 'delete'
  })
}
